<?php
namespace Tbf\Bundle\CronBundle\Tests;
use Symfony\Component\DependencyInjection\Container;
use Tbf\Bundle\CronBundle\CronManager;
use Tbf\Bundle\CronBundle\Entity\CronRepository;
use Tbf\Bundle\TestBundle\Logger\ArrayLogger;
use Tbf\Bundle\TestBundle\TestSuite\TbfTestCase;
use Tbf\Component\DateTime\Clock\SystemClock;

class CronBundleTestCase extends TbfTestCase
{
    public function setUp(){
        parent::setUp();
        $bundles = $this->getClientDic()->getParameter('kernel.bundles');
        if (empty($bundles['TbfCronBundle'])){
            $this->markTestSkipped('you need add TbfCronBundle to you kernel to test it');
        }
    }
    protected function newCronMock()
    {
        return $this->getMock('\Tbf\Bundle\CronBundle\Entity\Cron',array(),array(),'',false);
    }
    protected function newRepositoryMock()
    {
        return $this->getMock('\Tbf\Bundle\CronBundle\Entity\CronRepository',array(),array(),'',false);
    }
    protected function newTaskMock()
    {
        return $this->getMock('\Tbf\Bundle\TaskManageBundle\TaskInterface');
    }
    protected function newDateListMock()
    {
        return $this->getMock('\Tbf\Component\DateTime\DateSequence\DateSequenceInterface');
    }
    protected function newCronManager(CronRepository $repository){
        return new CronManager($repository,new Container(),new ArrayLogger(),new SystemClock());
    }
}
